<?php

namespace App\Admin\Actions\Post;

use App\Model\Batch;
use App\Model\Sncode;
use Encore\Admin\Actions\RowAction;
use Illuminate\Database\Eloquent\Model;

class Delete extends RowAction
{
    public $name = '删除';
    public function handle(Model $model)
    {
        // $model ...
        $id=$model->id;
        Sncode::where('batch_id',$id)->delete();
        Batch::where('id',$id)->delete();
        return $this->response()->success('删除完成！')->refresh();
    }
    public function dialog()
    {
        $this->confirm('确定删除？');
    }

}
